<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    // 在数组原型上添加 myForEach 方法
    Array.prototype.myForEach = function(callback) {
            for (let i = 0; i < this.length; i++) {
                callback(this[i],i,this)
            }
    }
    
    let arr = [3,5,7,4]
    let newArr = []
    arr.myForEach((item,index,arr) => {
        // console.log(item)
        newArr.push(item+= 1);
    })
    console.log(newArr);
    </script>
</body>
</html>